package com.youbug.common.config;

import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

@Configuration
public class DataSourceConfig {

    @Bean(name = "remote-system")
    @ConfigurationProperties(prefix = "spring.datasource-remote.system")
    public DataSource remoteDataSourceKefu(@Qualifier("prodAes") AES aes) {
        return new MyDataSource(aes);
    }

    @Bean(name = "remoteSysJdbcTemplate")
    public JdbcTemplate remoteSysJdbcTemplate(@Qualifier("remote-system")DataSource datasource){

        return new JdbcTemplate(datasource);
    }
}
